import 'package:flutter/material.dart';
import 'package:untitled/pages/home/tab_search/data_list.dart';
import 'package:untitled/widgets/common_float_action_button.dart';
import 'package:untitled/widgets/room_list_item_widget.dart';

//房屋管理页面
class RoomManagePage extends StatelessWidget {
  const RoomManagePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 2,
        initialIndex: 0, //默认条目
        child: Scaffold(
          floatingActionButtonLocation:
              FloatingActionButtonLocation.centerFloat,
          floatingActionButton: CommonFloatingActionButton('发布房源',(){
            Navigator.of(context).pushNamed('roomAdd');
          }),
          appBar: AppBar(
            title: Text('房屋管理'),
            bottom: TabBar(
              indicatorColor: Colors.white, //指示器颜色
              //labelColor: Colors.blue,//指示器上文字颜色
              //unselectedLabelColor: Colors.white,//指示器上文字未选中时颜色
              indicatorSize: TabBarIndicatorSize.label, //和指示器上文字等宽
              tabs: [
                Tab(
                  text: '空置',
                ),
                Tab(
                  text: '已租',
                )
              ],
            ),
          ),
          body: TabBarView(
            children: [
              ListView(
                children:
                    dataList.map((item) => RoomListItemWidget(item)).toList(),
              ),
              ListView(
                children:
                    dataList.map((item) => RoomListItemWidget(item)).toList(),
              ),
            ],
          ),
        ));
  }
}



